//
//  SelectLineViewController.m
//  OCUI
//
//  Created by login on 15-7-27.
//
//

#import "SelectLineViewController.h"

@interface SelectLineViewController ()<UITableViewDataSource,UITableViewDelegate>
{
    UITableView *selectLineTableView;
}
@property(nonatomic,copy)NSArray *lineArray;
@end


@implementation SelectLineViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"选择线路";
    
    self.lineArray = @[@"北京----八达岭",@"北京----廊坊",@"北京----天津市区",@"北京----延庆县",@"北京----密云县",@"北京----唐山",@"北京----香河",@"北京----石家庄",];
    
    [self initTableView];
}

- (void)initTableView
{
    selectLineTableView = [[UITableView alloc]initWithFrame:self.view.frame];
    selectLineTableView.delegate = self;
    selectLineTableView.dataSource = self;
    [self.view addSubview:selectLineTableView];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.lineArray.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    static NSString *cellIdentifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    cell.textLabel.text = self.lineArray[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 50;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *headerView = [[UIView alloc]init];
    headerView.backgroundColor = [UIColor whiteColor];
    
    UISearchBar *search = [[UISearchBar alloc]initWithFrame:CGRectMake(30, 0, self.view.frame.size.width-60, 40)];
    search.placeholder = @"中文或者首字母";
    search.delegate = self;
    [search setTintColor:[UIColor blackColor]];
    search.searchBarStyle = UISearchBarStyleMinimal;
    
    [headerView addSubview:search];
    return headerView;
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
